{include file="public/head"}

<body>
<div id="wrapper">
    {include file="public/menu"}

    <div id="page-wrapper" class="gray-bg dashbard-1">
        {include file="public/nav"}
        <div class="row wrapper border-bottom white-bg page-heading">
            <div class="col-lg-10">
                <h2>公告信息</h2>
                <ol class="breadcrumb">
                    <li>
                        <a href="{:url('Index/index')}">主页</a>
                    </li>
                    <li>
                        <a>公告</a>
                    </li>
                    <li>
                        <strong>公告列表</strong>
                    </li>
                </ol>
            </div>
            <div class="col-lg-2">

            </div>
        </div>
        <div class="wrapper wrapper-content animated fadeInRight">
            <div class="row">
                <div class="col-lg-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <h5>公告信息列表</h5>
                            <div class="ibox-tools">
                                <small>共 {$Count} 条</small>
                            </div>
                        </div>

                        <div class="ibox-content">
                            <div class="row">
                                <div class="col-sm-3">
                                    <div class="input-group">
                                        <a href="javascript:;" onclick="notice_add('添加公告','{:url("Notice/NoticeAdd")}','1000','600')" class="btn btn-sm btn-primary"> 添加公告</a>
                                    </div>
                                </div>
                            </div>
                            <div class="table-responsive">
                                <table class="table table-hover">
                                    <thead>
                                    <tr>
                                        <th>#</th>
                                        <th>公告标题</th>
                                        <th>公告排序</th>
                                        <th>添加时间</th>
                                        <th>公告操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    {volist name="NoticeList" id="v"}
                                    <tr>
                                        <td>{$key+1}</td>
                                        <td>{$v.title}</td>
                                        <td>{$v.sort}</td>
                                        <td>{$v.add_time|date="Y-m-d H:i:s",###}</td>
                                        <td>
                                            <a title="公告编辑" href="javascript:;" onclick="notice_edit('公告编辑','{:url("Notice/NoticeEdit",["id"=>$v["id"]])}','1000','600')"><i class="fa fa-edit text-navy"></i></a>
                                            <a title="公告删除" href="javascript:;" onClick="notice_del(this,{$v.id})"><i class="fa fa-trash text-navy"></i></a>
                                        </td>
                                    </tr>
                                    {/volist}
                                    </tbody>
                                </table>
                            </div>
                            <div class="row" style="text-align: center">
                                {$Page}
                            </div>
                        </div>
                    </div>
                </div>

            </div>
        </div>
        {include file="public/foot"}

    </div>
</div>
</div>
{include file="public/footer"}
<script>
    /*公告-增加*/
    function notice_add(title,url,w,h){
        layer_show(title,url,w,h);
    }

    /*公告-编辑*/
    function notice_edit(title,url,w,h){
        layer_show(title,url,w,h);
    }

    /*等级-删除*/
    function notice_del(obj,id){
        layer.confirm('确认要删除吗？',function(index){
            $.ajax({
                type:"post",
                url:"{:url('Notice/NoticeDelete')}",
                data:{
                    id:id,
                },
                dataType:"json",
                success:function(data){
                    if(data.status == 1){
                        layer.msg(data.message,{icon: 6,time:1500},function () {
                            window.location.reload();
                        });
                    }else{
                        layer.msg(data.message,{icon: 5,time:1500});
                    }
                }
            });
        });
    }
</script>
</body>
</html>
